<?php
/* 
 * ********* CVS HEADER ********* 
 * 
 * $RCSfile: admuseraff.php,v $ 
 * $Date: 2005/08/29 13:25:39 $ 
 * $Revision: 1.2 $ 
 * 
 * ********* CVS HEADER ********* 
 */
require_once ("module/TPLN/TPLN.php");
$TPLN = new TPLN;

$TPLN -> Open($op_basepath."tpl/admuseraff.html");
$TPLN -> IncludeFile("header", "environnement/" . $session["environnement"] . "/header.php");
$TPLN -> IncludeFile("footer", "environnement/" . $session["environnement"] . "/footer.php");

require_once(get_path_module("admin")); 
$pc = new panneau_controle(); 
$pc->calculRubriqueParFonction('admusergest'); 
$TPLN->Parse("panneau_controle",$pc->retourneEntete());

$query = "SELECT utilisateur.id AS id,utilisateur.login AS login,utilisateur.nom AS nom,";
$query.= "utilisateur.prenom AS prenom,utilisateur.email AS email,groupe.id AS id_groupe,";
$query.= "groupe.nom AS groupe,environnement.nom AS environnement";
$query.= " FROM utilisateur,groupe,environnement";
$query.= " WHERE utilisateur.id='$argid' AND utilisateur.id_groupe=groupe.id AND groupe.id_environnement=environnement.id";

$result = rportalrequete($query) or die("ERREUR 0133");

if ($row = rportalligne($result)) {
	$TPLN -> Parse("login", $row["login"]);
	$TPLN -> Parse("nom", $row["nom"]);
	$TPLN -> Parse("prenom", $row["prenom"]);
	$TPLN -> Parse("email", $row["email"]);
	$TPLN -> Parse("groupe", $row["groupe"]);
	$TPLN -> Parse("environnement", $row["environnement"]);
}

$groupdefsupp= $rportalparams->get_value("RPORTAL","groupe.corbeille");
if ($row[id_groupe] != $groupdefsupp) {
	$the_group_bloc = "notgroupdefsupp";

	$groupdefseq = $rportalparams->get_value("RPORTAL","groupe.sequenceur");
	$groupdefarch= $rportalparams->get_value("RPORTAL","groupe.archive");
	$groupdefsupp= $rportalparams->get_value("RPORTAL","groupe.corbeille");
	
	$query = "SELECT * from groupe,groupe_management";
	$query.= " WHERE groupe.id!='" . $row["id_groupe"] . "' AND groupe.id!='$groupdefsupp'";
	$query.= " AND groupe.id!='$groupdefarch' AND groupe.id!='$groupdefseq'";
	$query.= " AND groupe_management.id_groupe='" . $session["id_groupe"] . "' AND groupe_management.id_management=groupe.id";
	$query.= " GROUP BY groupe.id ORDER BY groupe.nom";
	$result = rportalrequete($query) or die("ERREUR 0134");
	$the_sub_bloc = ".liste_groupes";
	while ($row2 = rportalligne($result)) {
		$TPLN -> Parse($the_group_bloc.$the_sub_bloc.".group_value",	$row2["id"]);
		$TPLN -> Parse($the_group_bloc.$the_sub_bloc.".groupe_nom",		$row2["nom"]);
		$TPLN -> Loop($the_group_bloc.$the_sub_bloc);
	}

	$query = "SELECT id,nom";
	$query.= " FROM sequence";
	$query.= " ORDER BY nom ASC";
	$result = rportalrequete($query) or die("ERREUR 0148");
	$the_sub_bloc = ".liste_sequences";
	while ($row2 = rportalligne($result)) {
		$TPLN -> Parse($the_group_bloc.$the_sub_bloc.".seq_value",	$row2["id"]);
		$TPLN -> Parse($the_group_bloc.$the_sub_bloc.".seq_nom",	$row2["nom"]);
		$TPLN -> Loop($the_group_bloc.$the_sub_bloc);
	}
	$TPLN -> Parse($the_group_bloc.".id_groupe",	$row["id_groupe"]);
	$TPLN -> EraseBloc("groupdefsupp");

} else {
	$the_group_bloc = "groupdefsupp";
	$TPLN -> EraseBloc("notgroupdefsupp");
}
$TPLN -> Parse($the_group_bloc.".argid", $argid);

$TPLN->Write();
?>